package com.sanyang.lawyer.service.Audit;

import com.sanyang.lawyer.ResultApi.ResponseResult;
import com.sanyang.lawyer.entity.Audit;
import com.sanyang.lawyer.entity.Audit_type;
import com.sanyang.lawyer.entity.Case_audit;
import com.sanyang.lawyer.entity.Case_law;
import com.sanyang.lawyer.mapper.audit.Audit_remissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class Audit_remissionService {
    
    @Autowired
    private Audit_remissionMapper remissionMapper;
    
    
    
    public void insertOne(Case_audit auditRemission){//给费用表添加数据
        remissionMapper.insertOne(auditRemission);
    }
    
    public void insertInAudit(Case_audit auditRemission){
        auditRemission.getAuditid().setState("未审核");
        Audit_type audit_type = new Audit_type();  //写死 2代表费用减免申请
        audit_type.setTypeid(2);
        auditRemission.getAuditid().setTypeid(audit_type);
        
        remissionMapper.insertInAudit(auditRemission.getAuditid());
    }

    //根据流程id查询出对应的案件信息和费用减免金额
    public Case_audit queryCaseAndRemissionByProcessid(String processid){
        return remissionMapper.queryCaseAndRemissionByProcessid(processid);
    }
    
    //完成审核修改数据
    public void complateUpdate(Audit audit){
        System.out.println(audit);
        audit.setAuditTime(new Date());
        remissionMapper.complateUpdate(audit);
    }

    //查询出当前登陆的用户对应.的所有的费用申请
    public List<Case_audit> queryremissionAll(Case_law case_law){
        return remissionMapper.queryremissionAll(case_law);
    }
    
    
}
